

import freemarker.ext.servlet.FreemarkerServlet;
import org.apache.catalina.Context;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.startup.Tomcat;

import java.io.File;


public class Main {
    public static void main(String[] args) throws LifecycleException {
        Tomcat t = new Tomcat();


        Context ctx = t.addContext("/", new File(".").getAbsolutePath());

        Tomcat.addServlet(ctx, "testServlet", new TestServlet());
        Tomcat.addServlet(ctx, "freeMarkerServlet", new FreemarkerServlet());

        ctx.addServletMapping("/", "testServlet");
        ctx.addServletMapping("*.ftl", "freeMarkerServlet");

        t.start();

        t.getServer().await();
    }
}
